//
//  PBMyAcountCell.m
//  PBHomeDemo
//
//  Created by Playboy on 2018/5/15.
//  Copyright © 2018年 tmkj. All rights reserved.
//

#import "PBMyAcountCell.h"
#import "PBPayTypeModel.h"
#import "PBPayNowController.h"
#import "PBAccountDetailController.h"

@interface PBMyAcountCell ()
@property (weak, nonatomic) IBOutlet UILabel *numLabel;
@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *desLabel;
@property (weak, nonatomic) IBOutlet UIButton *payButton;
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (nonatomic, strong) PBMyAcountModel *model;
@end

@implementation PBMyAcountCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.payButton.layer.cornerRadius = 5;
    self.payButton.layer.borderColor = UIColorWithRGB(243,159,13).CGColor;
    self.payButton.layer.borderWidth = 1.0f;
    
    self.bgView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    self.bgView.layer.shadowOpacity = 0.5f;
    self.bgView.layer.shadowOffset = CGSizeMake(0,0);
    self.bgView.layer.cornerRadius = 3;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)refreshWithModel:(PBMyAcountModel *)model {
    self.model = model;
    self.nameLabel.text = model.communityName;
    self.desLabel.text = model.houseName;
    self.numLabel.text = [NSString stringWithFormat:@"%@元/月",model.rent];
    [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:nil];
}


- (IBAction)payButtonClick:(UIButton *)sender {
//    PBPayTypeModel *model = [[PBPayTypeModel alloc] init];
//    model.price = self.model.payable;
//    PBPayNowController *vc = [[PBPayNowController alloc] init];
//    vc.payModel = model;
//    vc.creatTime = self.model.payableDate;
//
//    NSDictionary *param = @{@"billId":self.model.ID};
//    [TMNetwork requestPostWithParam:param url:@"/order/createBill" callback:^(TMBaseReqModel *model) {
//        if (model.code == 200) {
//            vc.code = model.data;
//            [self.jumpVC.navigationController pushViewController:vc animated:YES];
//        }else {
//            [self showHint:model.message];
//        }
//    }];
    
    PBAccountDetailController *vc = [[PBAccountDetailController alloc] init];
    vc.houseId = self.model.houseId;
    [self.jumpVC.navigationController pushViewController:vc animated:YES];
    
    
}

@end
